<template>
  <div class="appwrap">
    <!-- <div class="onesec" v-for="(item, index) in pagedata" :key="index">
      {{ item.sectitle }}
    </div> -->

    <!-- <van-collapse v-model="activeName" accordion class="collapsesec">
      <van-collapse-item
        class="onesec"
        v-for="(item, index) in pagedata"
        :key="index"
        :name="index"
      >
        <template #title>
          <div class="sec_title">{{ item.sectitle }}</div>
        </template>
        <div
          class="onecell"
          v-for="(item2, index2) in item.seclist"
          :key="index2"
          @click="cellclick(index, index2)"
        >
          <div class="celltitle">{{ item2.app_title }}</div>

          <van-icon name="arrow" />
        </div>
      </van-collapse-item>
    </van-collapse> -->

    <div class="onesec" v-for="(item, index) in pagedata" :key="index">
      <div class="sec_title">{{ item.sectitle }}</div>

      <div
        class="onecell"
        v-for="(item2, index2) in item.seclist"
        :key="index2"
        @click="cellclick(index, index2)"
      >
        <div class="celltitle">{{ item2.app_title }}</div>
        <!-- <div class="arrow">></div> -->
        <van-icon name="arrow" size="20" color="#00b4aa" />
      </div>
    </div>
  </div>
</template>

<script>
import datadic from '@/utils/data.js'

export default {
  data () {
    return {
      pagedata: [],
      activeName: '0'
    }
  },
  mounted () {
    this.pagedata = datadic
    console.log('datadic: ', datadic)
    // this.initVideo()
  },
  methods: {
    initVideo () {
      const myVideo = this.$refs.myVideo
      // 初始化视频方法
      this.$video(myVideo, {
        // 确定播放器是否具有用户可以与之交互的控件。没有控件，启动视频播放的唯一方法是使用autoplay属性或通过Player API。
        controls: true,
        // 自动播放属性,muted:静音播放
        autoplay: 'muted',
        // 建议浏览器是否应在<video>加载元素后立即开始下载视频数据。
        preload: 'auto',
        // 设置视频播放器的显示宽度（以像素为单位）
        width: '300px',
        // 设置视频播放器的显示高度（以像素为单位）
        height: '400px'
      })
    },
    cellclick (index1, index2) {
      const targetdic = this.pagedata[index1].seclist[index2]
      console.log('targetdic: ', targetdic)

      // this.$router.push({ path: '/login', query: { stage: stage } });
      //  queryData.stage = this.$route.query.stage

      this.$router.push({
        name: 'appdetail',
        query: {
          index1: index1,
          index2: index2
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
// @import "assets/css/mixin.scss";

.appwrap {
  overflow-y: auto;
  padding: 20px;
  width: 100vw;
  // height: 100vh;
  // background: white;
  background-image: linear-gradient(to right, #1278f6, #00b4aa);

  @include flex_v_c;

  .onesec {
    overflow: hidden;
    // padding-left: 10px;
    // min-height: 44px;
    width: 100%;
    // border-left: red solid 3px;
    // height: 44px;
    border-radius: 5px;
    box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.1);
    font-weight: 350;
    font-size: 28px;
    // line-height: 1.5em;
    background: white;
  }
  .onesec:not(:first-child) {
    margin-top: 30px;
  }

  .collapsesec {
    overflow: hidden;
    margin-top: 30px;
    width: 100%;
    border-radius: 5px;
    // background: ;
  }
}

.sec_title {
  // color:#001938;
  color: #00b4aa;
  font-size: 24px;
  margin-left: 10px;
  margin-top: 5px;
  // border-left: #00b4aa solid 2px;
}
.onecell {
  // color:yellow;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 50px;

  .celltitle {
    color: #1278f6;
    font-size: 20px;
    // margin-top: 5px;
  }
  .arrow {
    font-size: 10px;
  }
}
</style>
